package test.configuration;

import java.net.UnknownHostException;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

import test.repository.MenuRepository;
import test.repository.MenuRepositoryImpl;
import test.service.ChatObservable;

import com.mongodb.MongoClient;

@Configurable
@EnableMongoRepositories(basePackages = {"test.repository","test.controller"})
public class MongoConfiguration {
	@Bean(name="mongoTemplate2")
	public MongoTemplate mongoTemplate(MongoClient mongo) throws UnknownHostException {
		return new MongoTemplate(new SimpleMongoDbFactory(mongo, "montotest01"));
	}

	@Bean
	public MongoClient mongo() throws UnknownHostException {
		return new MongoClient("192.168.163.216",8083);
	}
	@Bean(name="testR")
	public MenuRepository getMenuRepository(){
		return new MenuRepositoryImpl();
	}
	@Bean
	public ChatObservable getChatObservable(){
		return new ChatObservable();
	}
}
